<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Inziu Iosevka Slab SC:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="DatabaseThis database is described inMoody GB, Mark RG. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng in Med and Biol 20(3):45-50 (May-June 2001). (PMID: 11446209)Please cite this publicati">
<meta property="og:type" content="article">
<meta property="og:title" content="Reviewing and Comparing Algorithms for Detecting This Important ECG Waveform">
<meta property="og:url" content="http://idmk.oschina.io/2017/10/13/Reviewing-and-Comparing-Algorithms-for-Detecting-this-Important-ECG-Waveform/index.html">
<meta property="og:site_name" content="苦舟">
<meta property="og:description" content="DatabaseThis database is described inMoody GB, Mark RG. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng in Med and Biol 20(3):45-50 (May-June 2001). (PMID: 11446209)Please cite this publicati">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://idmk.oschina.io/2017/10/13/Reviewing-and-Comparing-Algorithms-for-Detecting-this-Important-ECG-Waveform/assets/markdown-img-paste-20171014015637378.png">
<meta property="og:updated_time" content="2017-11-22T15:33:54.326Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Reviewing and Comparing Algorithms for Detecting This Important ECG Waveform">
<meta name="twitter:description" content="DatabaseThis database is described inMoody GB, Mark RG. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng in Med and Biol 20(3):45-50 (May-June 2001). (PMID: 11446209)Please cite this publicati">
<meta name="twitter:image" content="http://idmk.oschina.io/2017/10/13/Reviewing-and-Comparing-Algorithms-for-Detecting-this-Important-ECG-Waveform/assets/markdown-img-paste-20171014015637378.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://idmk.oschina.io/2017/10/13/Reviewing-and-Comparing-Algorithms-for-Detecting-this-Important-ECG-Waveform/"/>





  <title>Reviewing and Comparing Algorithms for Detecting This Important ECG Waveform | 苦舟</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">苦舟</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">学海无涯，吾将上下求索。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://idmk.oschina.io/2017/10/13/Reviewing-and-Comparing-Algorithms-for-Detecting-this-Important-ECG-Waveform/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="东木金">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苦舟">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Reviewing and Comparing Algorithms for Detecting This Important ECG Waveform</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-10-13T14:17:14+08:00">
                2017-10-13
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <a id="more"></a>
<h2 id="Database"><a href="#Database" class="headerlink" title="Database"></a>Database</h2><p>This database is described in<br>Moody GB, Mark RG. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng in Med and Biol 20(3):45-50 (May-June 2001). (PMID: 11446209)<br>Please cite this publication when referencing this material, and also include the standard citation for PhysioNet:<br>Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation 101(23):e215-e220 [Circulation Electronic Pages; <a href="http://circ.ahajournals.org/content/101/23/e215.full" target="_blank" rel="external">http://circ.ahajournals.org/content/101/23/e215.full</a>]; 2000 (June 13).</p>
<p>It contains 48 half-hour recordings of annotated ECG with a sampling rate of 360 Hz and 11-bit resolution over a 10-mV range.<br>Twenty-five recordings (records number 200 and above) with less common arrhythmias were selected from over 4000 24-hour ambulatory ECG recordings, and the rest was chosen randomly. Altogether there are 116137 QRS complexes in this database. While some records contain clear R-peaks and few artifacts (e.g., records 100-107), for some records the detection of QRS complexes is very difficult due to abnormal shapes, noise, and artifacts (e.g., records 108 and 207).</p>
<h2 id="Objective"><a href="#Objective" class="headerlink" title="Objective"></a>Objective</h2><p>In this paper we focus on an ECG beat detection algorithm using a FB-based approach for preprocessing.</p>
<h2 id="Outline"><a href="#Outline" class="headerlink" title="Outline"></a>Outline</h2><ul>
<li>Section II reviews the theory and design of FB ’ s [9], [10]. We explain certain properties of FB ’ s which are useful for ECG digital signal processing.</li>
<li>Section III explains the preprocessing operations performed on the ECG.</li>
<li>Section V describes the methods used to implement and test the algorithm.</li>
<li>Section VI presents performance results of the beat detection algorithm on the MIT/BIH database.</li>
<li>Section VII discusses the algorithm performance and advantages of the FB-based approach to ECG processing.</li>
</ul>
<h2 id="FB-THEORY"><a href="#FB-THEORY" class="headerlink" title="FB THEORY"></a>FB THEORY</h2><h3 id="The-FB-Strategy"><a href="#The-FB-Strategy" class="headerlink" title="The FB Strategy"></a>The FB Strategy</h3><p>Fig. 2 shows that the FB contains a set of analysis and synthesis filters.<br><img src="assets/markdown-img-paste-20171014015637378.png" alt="Fig. 2."><br>A FB contains a set of analysis filters which decompose the input signal into subbands with uniform bandwidths. The filters can be designed to reconstruct the subbands to result in a perfect reconstruction of the input signal. Ideal magnitude responses of the filters are shown.<br>The analysis filters decompose an incoming signal into specific frequency bands or subbands. Processing can be performed on each subband independently. The set of synthesis filters can then combine the processed subbands to result in a processed version of the input signal.</p>
<p>Thus, a FB-based algorithm involves decomposing a signal into frequency subbands, processing these subbands according to the application at hand, and then sometimes reconstructing the processed subbands.</p>
<p>Fig. 2 shows a general block diagram of a FB-based algorithm and ideal magnitude responses of the filters.</p>
<p>Many scenarios deal with signals which contain specific energy distributions in the frequency domain.<br>a significant proportion of the energy from the QRS complex extends to a frequency of 40 Hz, and even more if the Q, R, and S waves have very sharp morphologies.<br>The P and T waves, in general, have a significant proportion of their energy only up to 10 Hz.</p>
<p>Thus, a strategic approach to detecting heartbeats is to analyze different subbands of the ECG, rather than just the output of one filter which maximizes SNR of the QRS as in [3].</p>
<h3 id="FB-Block-Diagram"><a href="#FB-Block-Diagram" class="headerlink" title="FB Block Diagram"></a>FB Block Diagram</h3><p>This section reviews some of the theory of FB ’ s explained in [9]. As shown in Fig. 2 a FB contains analysis and synthesis filters, ach of length The analysis filters</p>
<h3 id="Aliasing-and-Imaging"><a href="#Aliasing-and-Imaging" class="headerlink" title="Aliasing and Imaging"></a>Aliasing and Imaging</h3><p>Algorithms such as the one described operate at the same rate as the input ECG. The filters used are designed to optimize the SNR of the QRS complex. Information from other frequency components of the ECG are filtered out and cannot be incorporated into the beat detection logic. Thus, the preprocessing filters are not useful to other ECG processing tasks. The search-back strategy sometimes results in a beat detection latency time of more than one heartbeat interval. This is not useful when immediate indication of the occurrence of a beat is needed.</p>
<p>所描述的算法与输入 ECG 的速率相同。所设计的滤波器用来优化 QRS 波群的信噪比。ECG 的其他频率成分的信息被过滤掉，不能被合并到节拍检测逻辑中。因此，预处理过滤器对其他 ECG 处理任务不起作用。搜索策略有时会导致心跳检测延迟时间超过一个心跳间隔。这是没用的，当立即指示发生的节拍是必要的。</p>
<p>a FB contains a set of analysis filters which decompose the bandwidth of the input signal into subband signals with uniform frequency bands.</p>
<p>The subbands can be downsampled since the subband bandwidth is much lower than that of the input signal.<br>子带可以被下采样，因为子带带宽比输入信号低得多。</p>
<p>the subbands may be reconstructed by a set of synthesis filters which will perfectly reconstruct the input signal. Fig. 2 shows the ideal magnitude responses of the filters.</p>
<p>Fig. 2. A FB contains a set of analysis filters which decompose the input signal into subbands with uniform bandwidths. The filters can be designed to reconstruct the subbands to result in a perfect reconstruction of the input signal. Ideal magnitude responses of the filters are shown.</p>
<p>图 2。FB 包含一组分析滤波器，它们将输入信号分解成均匀带宽的子带。滤波器可以被设计成重构子带，从而对输入信号进行完美的重构。滤波器的理想幅度响应。</p>
<p>子带提供来自不同频率范围的信息，因此，能够对输入信号执行时间和频率相关的处理。<br>Thus, the FB allows time and frequency-dependent processing to be performed at a computationally efficient rate to analyze the ECG.<br>因此，FB 允许以计算效率的速率进行时间和频率相关处理以分析心电图。</p>
<p>An overall goal is to develop one set of preprocessing filters which is useful in a variety of tasks for ECG processing, see Fig. 3.</p>
<p>Fig. 3. One set of preprocessing filters decompose the ECG into subbands with uniform bandwidths. Time and frequency-dependent processing can be performed on the subbands to accomplish multiple tasks at the reduced subband rate.</p>
<p>Furthermore, as we will explain in this paper, the FB-based approach inherently leads to a multirate strategy for processing the ECG.</p>
<p>Thus, processing tasks like ECG beat detection can be performed at a lower rate than the input sampling rate and this leads to the computational efficiency of the FB-based strategy.</p>
<p>ECG beat detection is an important component of many tasks in ECG processing and, thus, in this paper we focus on an ECG beat detection algorithm using a FB-based approach for preprocessing.</p>
<p>The analysis filters decompose an incoming signal into specific frequency bands or subbands. Processing can be performed on each subband independently.</p>
<p>The set of synthesis filters can then combine the processed subbands to result in a processed version of the input signal.</p>
<p>Fig. 2 shows a general block diagram of a FB-based algorithm and ideal magnitude responses of the filters.</p>
<p>Many scenarios deal with signals which contain specific energy distributions in the frequency domain.</p>
<p>For example, with regard to the ECG, a significant proportion of the energy from the QRS complex extends to a frequency of 40 Hz, and even more if the Q, R, and S waves have very sharp morphologies.<br>The P and T waves, in general, have a significant proportion of their energy only up to 10 Hz.</p>
<p>A heartbeat, whether originating in the sino-atrial node (SA), a supraventricular site, the junctional node, or one or two ectopic sites in the ventricle, results in a QRS complex which generally has a significantly higher frequency content than that of the T and P waves.<br>一次心跳，无论是产生于窦房结（SA），或室上性的一块区域，或连接点，或心室的一个或两个异位部位，都将造成一个频率比 T 波和 P 波的频率要高得多的 QRS 波群。</p>
<p>A QRS complex originating from an impulse in the SA node, will have a “ sharp ” morphology in the time domain and hence significant energy in the higher frequency subbands.</p>
<p>A QRS complex resulting from an ectopic site in the ventricles will have a “ rounded ” morphology and not as significant energy in the higher subbands, and in fact a stronger energy in the lower subbands.</p>
<p>Thus, a strategic approach to detecting heartbeats is to analyze different subbands of the ECG, rather than just the output of one filter which maximizes SNR of the QRS as in [3].</p>
<p>the synthesis filters</p>
<p>The reason for using the Perfect Reconstruction property of FB ’ s is that the overall goal is to develop one set of filters which is useful for multiple ECG processing tasks; see Fig. 3.</p>
<p>However, simultaneous processing of the subbands could be performed for other ECG processing tasks, such as ECG enhancement [6] and [7]. ECG enhancement requires reconstruction of the processed subbands. Thus, aliasing, and magnitude and phase distortions must be eliminated. This is the reason why the design of the FB should include the PR property.</p>
<p>For ECG beat detection it is important to have a deterministic relationship between fiducial points in the input ECG and the subband signal.</p>
<p>This requires that each of the analysis filters have linear phase.</p>
<p>he linear phase requirement when designing the FB ensures that all frequencies in the input signal will have the same sample delay through the analysis filters. I</p>
<p>It is then possible, for example, to determine the exact location of the R wave in the input ECG signal, and other fiducial points from analysis of the subbands.</p>
<p>This linear phase requirement on each filter in the FB should be distinguished from the linear phase property of the whole FB system.</p>
<p>Thus, the FB system output can have no phase distortion with respect to the input (i.e., a linear phase FB) even though each of the analysis and synthesis filters have nonlinear phase frequency responses.</p>
<p>However, for ECG processing it is important that each of the analysis and synthesis filters have a linear phase response.</p>
<p>Fig. 4 shows the magnitude responses of the filters used in the 32-channel FB. Each filter has 64 coefficients and is designed using the technique in [12]. The filters are FIR and result in a FB which does not have any aliasing, nor magnitude and phase distortions (i.e., it is a PR FB).</p>
<p>图 4 显示在 32 通道 FB 中使用的滤波器的幅度响应。每个滤波器有 64 个系数，并用文献[12]中的技术设计。滤波器是 FIR 的，结果是没有任何混淆现象，也没有幅度和相位失真的 FB (i.e., it is a PR FB)。</p>
<p>Furthermore each of the filters have linear phase and a bandwidth of 5.6 Hz.</p>
<p>The filters are operated once every 32 samples because of the downsampling process.</p>
<p>The downsampling process results in many subbands to be computed at the cost of one filter and efficiently computed using the polyphase implementation [9].<br>下采样过程的结果是许多子带以一个滤波器的代价计算，并使用多相实现有效地计算。</p>
<p>Reported statistics include beat detections beginning after 5 min in each record which is the default setting of the software included in the database.</p>
<p>The effect of the threshold values and the type of features on the beat detection accuracy were studied. The beat detection accuracy of a one-channel detection block was computed using various threshold values, and both the sum-of-square and sumof-absolute features discussed above. From this analysis the threshold values can be strategically chosen to provide beatdetection blocks with complementary detection rates (one with minimal FP ’ s, and the other with minimal FN ’ s).</p>
<p>研究了阈值和特征类型对节拍检测精度的影响。使用各种阈值计算单通道检测块的节拍检测精度，以及上面讨论的平方和和绝对特征。</p>
<p>In Section II, we explained that it is important that the FB used to process the ECG have certain characteristics.<br>The analysis and synthesis filters should have linear phase.</p>
<p>The analysis and synthesis filters should have linear phase. Linear phase ensures that the fiducial points in the ECG, such as the R wave, have the same sample delay through all the filters.</p>
<p>Linear phase ensures that the fiducial points in the ECG, such as the R wave, have the same sample delay through all the filters.</p>
<p>he perfect reconstruction property was also incorporated into the design of the FB because an overall goal is to develop one set of filters to accomplish multiple ECG processing tasks.</p>
<p>We presented a FB-based stress ECG enhancement in [6] and [7] using the same FB as the one used for the beat detection algorithm in this study. It is also important that the filters have good stop band attenuation.</p>
<p>The design of FB ’ s which meet these compromising characteristics is challenging [9]–[12]. Existing FB design methods which meet the above characteristics result in analysis and synthesis filters with uniform filter bandwidths. Thus, in this study the analysis filters used to preprocess the ECG for beat detection have uniform filter bandwidths.</p>
<p>B. Computational Efficiency</p>
<p>Since the subbands in the FB are downsampled, processing can be performed at the subband rate. Thus, the beat detection algorithm occurs at the downsampled rate. The components of the one-channel detection block such as the feature computation, MWI, and peak detector are operated at a lower rate than the input sampling rate of the ECG. The FB, thus, enables the analysis of multiple frequency bands very efficiently.</p>
<p>C. Detection Latency<br>The challenge with real-time algorithms is to output beat detections as soon as possible after the beat. This requires the beat detection algorithm to be computationally efficient and the detection logic to have minimal latency.<br>Many beat detection algorithms have been reported in the literature [3], [4]. Most of these algorithms incorporate a search-back strategy to correct for FN ’ s.</p>
<p>This strategy may result in a significant delay before a beat is detected. The search-back technique may require one or two extra beats to occur before the actual detection of the beat in question occurs.</p>
<p>Unified Algorithm for ECG Processing</p>
<p>further improvements</p>
<p>The FB-based algorithm provides a unified framework for other ECG signal processing tasks such as signal enhancement, noise alert, and arrhythmia classification.</p>
<p>Another useful processing task is a noise alert algorithm which determines the fidelity of the ECG by indicating the level and type of noise in the signal.</p>
<p>Fig. 1. Multiple processing tasks are performed on the ECG. An overall goal is to effectively accomplish these multiple tasks at a computationally efficient rate with one set of preprocessing filters.</p>
<p>A crucial part of any ECG processing algorithm is beat detection. References [2] and [3] represent original works on the subject of ECG beat detection.</p>
<p>Work Group: ECG</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/10/11/ECG-Project/" rel="next" title="ECG Project">
                <i class="fa fa-chevron-left"></i> ECG Project
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/10/23/Wavelet-Transform/" rel="prev" title="Wavelet Transform">
                Wavelet Transform <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatar.jpg"
               alt="东木金" />
          <p class="site-author-name" itemprop="name">东木金</p>
           
              <p class="site-description motion-element" itemprop="description">正在学习机器学习，希望能变得很强！</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">18</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">42</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/bdmk" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                    
                      GitHub
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="mailto:catcherchan94@outlook.com" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Database"><span class="nav-number">1.</span> <span class="nav-text">Database</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Objective"><span class="nav-number">2.</span> <span class="nav-text">Objective</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Outline"><span class="nav-number">3.</span> <span class="nav-text">Outline</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#FB-THEORY"><span class="nav-number">4.</span> <span class="nav-text">FB THEORY</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#The-FB-Strategy"><span class="nav-number">4.1.</span> <span class="nav-text">The FB Strategy</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#FB-Block-Diagram"><span class="nav-number">4.2.</span> <span class="nav-text">FB Block Diagram</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Aliasing-and-Imaging"><span class="nav-number">4.3.</span> <span class="nav-text">Aliasing and Imaging</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2017 - 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">东木金</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Gemini
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'manual') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
